<html lang="en">
<head>
	<meta charset="utf-8">
	<link rel="stylesheet" href="https://checkout.payoneer.com/paymentpage/v3/op-payment-widget-v3.min.css">
	<script type="text/javascript" src="jquery-2.1.1.js"></script>
</head>

<body>
 
	<div id="payment-box" class="m-b">
		<div class="row">

			<div id="payoneerNetworksId"></div>
			<div id="submitBtnContainerId">
				<button id="payoneerSubmitId" type="button"></button>
			</div>
		</div>
	</div>

<script src="https://checkout.payoneer.com/paymentpage/v3/op-payment-widget-v3.min.js"></script>
<script type="text/javascript">

	payoneerPay();
	
	
	function payoneerPay(){

                $.ajax({
                    dataType: 'json',
                    type: 'post',
                    url: "/pay/payoneerCreateorder",	//接口请求
                    data: {
                        id: 1		
                    },
                    timeout: 20000,     //设置超时时间为20s
                    success: function (res) { 
                  
                        if(res.code==200){
                            links = res.data.links;
                            initPaymentPage(links);
                        }
                        else{
                            alert(res.msg);
                        }
                    },
                    error: function(xhr, textStatus, errorThrown) {
                       
                        if (textStatus === 'timeout') {
                            console.error('请求超时');
                            alert('payoneer request timeout');
                        } else {
                            console.error('payoneer发生错误:', errorThrown);
                            alert('payoneer request error:'.errorThrown);
                        }
                    }
                });

    }

    function initPaymentPage(links) {
        var dict = {};
        checkoutList('payoneerNetworksId', {
            payButton: 'payoneerSubmitId',
            payButtonContainer: 'submitBtnContainerId',
            listUrl: links.self,
            smartSwitch: true,
        });
    }
</script>

</body>
</html>